package com.yun.platform.iot.controller;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yun.platform.config.BaseCURDController;
import com.yun.platform.config.dto.RData;
import com.yun.platform.iot.entity.AutoGroup;
import com.yun.platform.iot.service.AutoGroupService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: Hanson  2022-11-24
 *
 * @Desciprtion:  自动化与组关系表
相关接口
 */
@RestController
@RequestMapping("/iot/AutoGroup/")
@Slf4j
@Api(value = "自动化与组关系表 相关接口", tags = {"自动化与组关系表 操作接口"})
public class AutoGroupController extends BaseCURDController<AutoGroup> {

    @Autowired
    private AutoGroupService autoGroupService;

    @Override
    public ServiceImpl getService() {
        return autoGroupService;
    }

    /**
     * 自动化与组关系，
     */
    @ApiOperation("根据自动化ID得到分组")
    @PostMapping("/autoAndGroup")
    public RData autoAndGroup(@RequestParam Integer autoId){
        return RData.success(autoGroupService.listByAutoId(autoId));
    }


}